<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="FilEscursioneListForm">

        <p:panel header="#{myBundle.ListEscursioneTitle}">

            <p:dataTable id="datalist1" value="#{filEscursioneController.items}" var="item"
                         selectionMode="single" selection="#{filEscursioneController.selected}"
                         rowKey="#{item.idESCURSIONE}"
                         paginator="true"
                         rows="10"
                         rowsPerPageTemplate="10,20,30"
                         >

                <p:ajax event="rowSelect"   update="createButton deleteButton"/>
                <p:ajax event="rowUnselect" update="createButton deleteButton"/>

                <p:column sortBy="#{item.idESCURSIONE}" filterBy="#{item.idESCURSIONE}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_idESCURSIONE}"/>
                    </f:facet>
                    <h:outputText value="#{item.idESCURSIONE}"/>
                </p:column>
                <p:column sortBy="#{item.prezzo}" filterBy="#{item.prezzo}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_prezzo}"/>
                    </f:facet>
                    <h:outputText value="#{item.prezzo}"/>
                </p:column>
                <p:column sortBy="#{item.data}" filterBy="#{item.data}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_data}"/>
                    </f:facet>
                    <h:outputText value="#{item.data}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>
                </p:column>
                <p:column sortBy="#{item.descrizione}" filterBy="#{item.descrizione}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_descrizione}"/>
                    </f:facet>
                    <h:outputText value="#{item.descrizione}"/>
                </p:column>
                <p:column sortBy="#{item.luogo.nome}" filterBy="#{item.luogo.nome}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_luogo}"/>
                    </f:facet>
                    <h:outputText value="#{item.luogo.nome}"/>
                </p:column>
                <p:column sortBy="#{item.luogo.nazione}" filterBy="#{item.luogo.nazione}">
                    <f:facet name="header">
                        <h:outputText value="Nazione"/>
                    </f:facet>
                    <h:outputText value="#{item.luogo.nazione}"/>
                </p:column>
                <f:facet name="footer">
                    <div class="footer-section">
         <p:commandButton id="createButton" icon="ui-icon-plus"   
                          value="Add Element" 
                          actionListener="#{composizioneController.prepareCreate}" 
                          update=":ComposizioneCreateForm" 
                          oncomplete="ComposizioneCreateDialog.show()"/>
         
                        <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{myBundle.Delete}" actionListener="#{composizioneController.delete}" action="#{context.getURL}" >
                            
                            <f:param name="elemDel" value="#{filEscursioneController.selected.idESCURSIONE}" />
                            <f:param name="travDel" value="#{travelId.ID}" />       
                        </p:commandButton>
                    </div>
                </f:facet>

            </p:dataTable>

        </p:panel>

    </h:form>

</ui:composition>